package com.hollycrm.hollysqm.handle.service.v8;

import java.util.List;
import java.util.Map;

import com.hollycrm.hollysqm.entities.TblQmPlanParam;
import com.hollycrm.hollysqm.handle.service.PlanChain;
import com.hollycrm.hollysqm.util.Constant;

/**
 * （伪）责任链模式，在application-config.xml中配置
 * @author jianglong
 * @date 2017年3月21日 下午4:29:33
 */
public class V8PlanChainService extends PlanChain {		
	
	private List<PlanChain> planList = null;
	
	public void setPlanList(List<PlanChain> planList){
		this.planList = planList;
	}		
	
	/**
	 * 主入口
	 */
	@Override
	public String applyRule(TblQmPlanParam bean, Map<String, Object> paramMap) throws Exception {
		if (planList == null || planList.size()<=0) 
			throw new Exception("未获取到继承PlanChain的service...");
		for (PlanChain chain : planList){
			chain.applyRule(bean, paramMap);
		}		
		return Constant.SUCCESS;
	}
	
}
